#! /usr/bin/env python
#coding=utf-8
#import os
#import sys


class Ini2Dict:
    """ Assume that property file is "ARG=VALUE" format and no space is allowed on either side of \"=\" """
    def __init__(self):
        inifile = "config.ini"
        fp = open(inifile, 'r')
        self.items = {}
   
        for line in fp.readlines():
            line = line.strip()
            if not line: continue
            if line.startswith('#'): continue
            if line.startswith('['): continue
            key, value = line.split('=', 1)
            self.items[key.strip()] = value.strip()
        fp.close()
   
    def GetDict(self):
        return self.items
        
        
"""       
if __name__ == "__main__":
    i = Ini2Dict()
    ii = i.GetDict()
    print ii['db']
"""